package com.ruoyi.lvlian.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.utils.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

@Data
@ToString
@ApiModel(value = "物流入库单", description = "物流入库单")
public class WarehouseInfo {
    private static final long serialVersionUID = 1L;

    /**
     * 装车称重照片
     */
    @ApiModelProperty(value = "装车称重照片1")
    private String loadWeightImg;
    /**
     * 装车照片
     */
    @ApiModelProperty(value = "装车照片2")
    private String loadImg;

    @ApiModelProperty(value = "出库毛重磅头照片3")
    private String outGrossWeightImg;

    @ApiModelProperty(value = "出库过磅单照片4")
    private String outWeighNumImg;


    /**
     * 入库称重照片
     */
    @ApiModelProperty(value = "入库称重照片5")
    private String inWeightImg;

    /**
     * 卸货照片
     */
    @ApiModelProperty(value = "卸货照片6")
    private String unloadImg;

    @ApiModelProperty(value = "入库毛重磅头照片7")
    private String inGrossWeightImg;
    /**
     * 入库过磅单照片
     */
    @ApiModelProperty(value = "入库过磅单照片8")
    private String inWeighNumImg;

    public String getLoadWeightImg() {
        if ("https://data.lvlianhengsheng.com/dev-api".equalsIgnoreCase(loadWeightImg) || StringUtils.countMatches(loadWeightImg, "http") > 1) {
            return null;
        }
        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(loadWeightImg) && !loadWeightImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + loadWeightImg;
        }
        return loadWeightImg;
    }

    public String getLoadImg() {
        if ("https://data.lvlianhengsheng.com/dev-api".equalsIgnoreCase(loadImg) || StringUtils.countMatches(loadImg, "http") > 1) {
            return null;
        }
        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(loadImg) && !loadImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + loadImg;
        }
        return loadImg;
    }

    public String getOutGrossWeightImg() {
        if ("https://data.lvlianhengsheng.com/dev-api".equalsIgnoreCase(outGrossWeightImg) || StringUtils.countMatches(outGrossWeightImg, "http") > 1) {
            return null;
        }
        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(outGrossWeightImg) && !outGrossWeightImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + outGrossWeightImg;
        }
        return outGrossWeightImg;
    }

    public String getInWeightImg() {
        if ("https://data.lvlianhengsheng.com/dev-api".equalsIgnoreCase(inWeightImg) || StringUtils.countMatches(inWeightImg, "http") > 1) {
            return null;
        }
        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(inWeightImg) && !inWeightImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + inWeightImg;
        }
        return inWeightImg;
    }

    public String getUnloadImg() {
        if ("https://data.lvlianhengsheng.com/dev-api".equalsIgnoreCase(unloadImg) || StringUtils.countMatches(unloadImg, "http") > 1) {
            return null;
        }
        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(unloadImg) && !unloadImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + unloadImg;
        }
        return unloadImg;
    }

    public String getInGrossWeightImg() {
        if ("https://data.lvlianhengsheng.com/dev-api".equalsIgnoreCase(inGrossWeightImg) || StringUtils.countMatches(inGrossWeightImg, "http") > 1) {
            return null;
        }
        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(inGrossWeightImg) && !inGrossWeightImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + inGrossWeightImg;
        }
        return inGrossWeightImg;
    }

    public String getInWeighNumImg() {
        if ("https://data.lvlianhengsheng.com/dev-api".equalsIgnoreCase(inWeighNumImg) || StringUtils.countMatches(inWeighNumImg, "http") > 1) {
            return null;
        }
        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(inWeighNumImg) && !inWeighNumImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + inWeighNumImg;
        }
        return inWeighNumImg;
    }


    public String getInNumImg() {
        if ("https://data.lvlianhengsheng.com/dev-api".equalsIgnoreCase(inNumImg) || StringUtils.countMatches(inNumImg, "http") > 1) {
            return null;
        }
        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(inNumImg) && !inNumImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + inNumImg;
        }
        return inNumImg;
    }


    public String getOutNumImg() {
        if ("https://data.lvlianhengsheng.com/dev-api".equalsIgnoreCase(outNumImg) || StringUtils.countMatches(outNumImg, "http") > 1) {
            return null;
        }
        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(outNumImg) && !outNumImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + outNumImg;
        }
        return outNumImg;
    }

    public String getOutWeighNumImg() {
        if ("https://data.lvlianhengsheng.com/dev-api".equalsIgnoreCase(outWeighNumImg) || StringUtils.countMatches(outWeighNumImg, "http") > 1) {
            return null;
        }
        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(outWeighNumImg) && !outWeighNumImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + outWeighNumImg;
        }
        return outWeighNumImg;
    }


    public void setBuyerAmount(Double buyerAmount) {
        this.buyerAmount = buyerAmount;
    }

    public void setBuyerSettlementAmount(Double buyerSettlementAmount) {
        this.buyerSettlementAmount = buyerSettlementAmount;
    }

    public String getInDate() {
        if(StringUtils.isEmpty( inDate)){
            return null;
        }
        if (StringUtils.isNotEmpty(inDate) && DateUtils.isValidDateTime(inDate)) {
            inDate = inDate.substring(0, 10);
        }
        if (StringUtils.isNotEmpty(inDate)) {
            inDate = DateUtils.unifyDateFormats(inDate);
        }

        return inDate;
    }

    public String getOutDate() {
        if(StringUtils.isEmpty( outDate)){
            return null;
        }
        if (StringUtils.isNotEmpty(outDate) && DateUtils.isValidDateTime(outDate)) {
            outDate = outDate.substring(0, 10);

        }
        if (StringUtils.isNotEmpty(outDate)) {
            outDate = DateUtils.unifyDateFormats(outDate);
        }
        return outDate;
    }

    public String getBuyerLoadedTime() {
        if (StringUtils.isNotEmpty(buyerLoadedTime) && DateUtils.isValidDateTime(buyerLoadedTime)) {
            buyerLoadedTime = buyerLoadedTime.substring(0, 10);
            buyerLoadedTime = DateUtils.unifyDateFormats(buyerLoadedTime);
        }
        if (StringUtils.isNotEmpty(buyerLoadedTime)) {
            buyerLoadedTime = DateUtils.unifyDateFormats(buyerLoadedTime);
        }
        return buyerLoadedTime;

    }

    public String getBuyerEmptyTime() {
        if (buyerEmptyTime == null || buyerEmptyTime.contains("0000")) {
            return "";
        }
        if (StringUtils.isNotEmpty(buyerEmptyTime) && DateUtils.isValidDateTime(buyerEmptyTime) && buyerEmptyTime.length() >= 8) {
            buyerEmptyTime = buyerEmptyTime.substring(buyerEmptyTime.length() - 8);
        }

        if (StringUtils.isNotEmpty(buyerEmptyTime)) {
            buyerEmptyTime = DateUtils.unifyDateFormats(buyerEmptyTime);
        }

        if (StringUtils.isNotEmpty(buyerEmptyTime)) {
            buyerEmptyTime = DateUtils.unifyDateFormats(buyerEmptyTime);
        }
        return buyerEmptyTime;
    }

    public String getSellerEmptyTime() {
        if (sellerEmptyTime == null || sellerEmptyTime.contains("0000")) {
            return "";
        }
        if (StringUtils.isNotEmpty(sellerEmptyTime) && DateUtils.isValidDateTime(sellerEmptyTime) && sellerEmptyTime.length() >= 8) {
            sellerEmptyTime = sellerEmptyTime.substring(sellerEmptyTime.length() - 8);
        }

        if (StringUtils.isNotEmpty(sellerEmptyTime)) {
            sellerEmptyTime = DateUtils.unifyDateFormats(sellerEmptyTime);
        }
        return sellerEmptyTime;
    }

    public String getBuyerLoadedDate() {
        if (buyerLoadedDate == null || buyerLoadedDate.contains("0000")) {
            return "";
        }
        if (StringUtils.isNotEmpty(buyerLoadedDate) && DateUtils.isValidDateTime(buyerLoadedDate) && buyerLoadedDate.length() >= 8) {
            buyerLoadedDate = buyerLoadedDate.substring(buyerLoadedDate.length() - 8);
        }

        if (StringUtils.isNotEmpty(buyerLoadedDate)) {
            buyerLoadedDate = DateUtils.unifyDateFormats(buyerLoadedDate);
        }
        return buyerLoadedDate;
    }

    public String getBuyerEmptyDate() {

        if (buyerEmptyDate == null || buyerEmptyDate.contains("0000")) {
            return "";
        }
        if (StringUtils.isNotEmpty(buyerEmptyDate) && DateUtils.isValidDateTime(buyerEmptyDate) && buyerEmptyDate.length() >= 8) {
            buyerEmptyDate = buyerEmptyDate.substring(buyerEmptyDate.length() - 8);
        }

        if (StringUtils.isNotEmpty(buyerEmptyDate)) {
            buyerEmptyDate = DateUtils.unifyDateFormats(buyerEmptyDate);
        }

        return buyerEmptyDate;
    }

    private String id;

    @ApiModelProperty(value = "司机姓名")
    @ExcelProperty("司机姓名")
    private String driverName;

    @ApiModelProperty(value = "对应司机驾驶证号")
    @ExcelProperty("对应司机驾驶证号")
    private String driverLicense;

    @ApiModelProperty(value = "车牌号")
    @ExcelProperty("车牌号")
    private String plateNo;

    @ApiModelProperty(value = "购买方入库日期"  ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("购买方入库日期")
    private String inDate;

    @ApiModelProperty(value = "购买方入库单号")
    @ExcelProperty("购买方入库单号")
    private String inNum;

    @ApiModelProperty(value = "购买方入库数量")
    @ExcelProperty("购买方入库数量")
    private String inQuantity;

    @ApiModelProperty(value = "购买方入库重量")
    @ExcelProperty("购买方入库重量")
    private String inWeight;

    @ApiModelProperty(value = "购买方入库单价")
    @ExcelProperty("购买方入库单价")
    private Double inUnitPrice;

    @ApiModelProperty(value = "销售方出库单号")
    @ExcelProperty("销售方出库单号")
    private String outNum;

    @ApiModelProperty(value = "销售方出库过磅日期" ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("销售方出库过磅日期")
    private String sellerWeighDate;

    @ApiModelProperty(value = "销售方出库数量")
    @ExcelProperty("销售方出库数量")
    private String outQuantity;

    @ApiModelProperty(value = "销售方出库重量")
    @ExcelProperty("销售方出库重量")
    private String outWeight;

    @ApiModelProperty(value = "销售方出库单价")
    @ExcelProperty("销售方出库单价")
    private Double outUnitPrice;

    @ApiModelProperty(value = "购买方入库货品名称")
    @ExcelProperty("购买方入库货品名称")
    private String buyerGoodsName;

    @ApiModelProperty(value = "购买方入库货品品类")
    private String productCategory;


    @ApiModelProperty(value = "购买方入库单计量单位")
    @ExcelProperty("购买方入库单计量单位")
    private String buyerGoodsUnit;

    @ApiModelProperty(value = "购买方税号")
    @ExcelProperty("购买方税号")
    private String buyerCode;

    @ApiModelProperty(value = "购买方名称")
    @ExcelProperty("购买方名称")
    private String buyerName;

    @ApiModelProperty(value = "购买方入库过磅单号")
    @ExcelProperty("购买方入库过磅单号")
    private String buyerWeighNum;

    @ApiModelProperty(value = "购买方入库过磅日期" ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("购买方入库过磅日期")
    private String buyerWeighDate;

    @ApiModelProperty(value = "对应采购合同编号")
    @ExcelProperty("对应采购合同编号")
    private String buyerContractNum;

    @ApiModelProperty(value = "过磅登记人")
    @ExcelProperty("过磅登记人")
    private String weigher;

    @ApiModelProperty(value = "购买方入库重车日期" ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("购买方入库重车日期")
    private String buyerLoadedDate;

    @ApiModelProperty(value = "购买方入库重车时间" ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("购买方入库重车时间")
    private String buyerLoadedTime;

    @ApiModelProperty(value = "购买方入库空车时间" ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("购买方入库空车时间"  )
    private String buyerEmptyTime;

    @ApiModelProperty(value = "购买方入库空车日期" ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("购买方入库空车日期")
    private String buyerEmptyDate;

    @ApiModelProperty(value = "购买方入库过磅单毛重")
    @ExcelProperty("购买方入库过磅单毛重")
    private Double buyerGrossWeight;

    @ApiModelProperty(value = "购买方入库过磅单皮重")
    @ExcelProperty("购买方入库过磅单皮重")
    private Double buyerTareWeight;

    @ApiModelProperty(value = "购买方入库过磅单净重")
    @ExcelProperty("购买方入库过磅单净重")
    private Double buyerNetWeight;

    @ApiModelProperty(value = "购买方入库过磅单扣重")
    @ExcelProperty("购买方入库过磅单扣重")
    private Double buyerDeductWeight;

    @ApiModelProperty(value = "购买方入库过磅单扣点")
    private Double buyerDeductPercent;


    @ApiModelProperty(value = "购买方询价金额")
    @ExcelProperty("购买方询价金额")
    private Double buyerAmount;

    @ApiModelProperty(value = "购买方折让/奖励金额")
    @ExcelProperty("购买方折让/奖励金额")
    private Double buyerRewardDiscountAmount;

    @ApiModelProperty(value = "奖励金额")
    @ExcelProperty("奖励金额")
    private Double buyerRewardAmount;

    @ApiModelProperty(value = "购买方结算金额")
    @ExcelProperty("购买方结算金额")
    private Double buyerSettlementAmount;

    @ApiModelProperty(value = "结算时间" ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("结算时间"
    )
    private String buyerSettlementTime;


    @ApiModelProperty(value = "入库单照片")
    @ExcelProperty("入库单照片")
    private String inNumImg;


    @ApiModelProperty(value = "销售方名称")
    @ExcelProperty("销售方名称")
    private String sellerName;

    @ApiModelProperty(value = "销售方税号")
    @ExcelProperty("销售方税号")
    private String sellerCode;

    @ApiModelProperty(value = "对应供销合同编号")
    @ExcelProperty("对应供销合同编号")
    private String sellerContractNum;

    @ApiModelProperty(value = "销售方出库过磅单号")
    @ExcelProperty("销售方出库过磅单号")
    private String sellerWeighNum;

    @ApiModelProperty(value = "出库单照片")
    @ExcelProperty("出库单照片")
    private String outNumImg;


    @ApiModelProperty(value = "物流分类")
    @ExcelProperty("物流分类")
    private String category;

    @ApiModelProperty(value = "创建人")
    @ExcelProperty("创建人")
    private String createUser;

    @ApiModelProperty(value = "创建日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("创建日期")
    private String createDate;

    @ApiModelProperty(value = "所属公司编码")
    @ExcelProperty("所属公司编码")
    private String orgCode;

    @ApiModelProperty(value = "销售方出库重车日期" ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("销售方出库重车日期")
    private String sellerLoadedDate;

    @ApiModelProperty(value = "销售方出库重车时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("销售方出库重车时间")
    private String sellerLoadedTime;

    @ApiModelProperty(value = "销售方出库空车日期" ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("销售方出库空车日期")
    private String sellerEmptyDate;

    @ApiModelProperty(value = "销售方出库空车时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("销售方出库空车时间")
    private String sellerEmptyTime;

    @ApiModelProperty(value = "销售方出库日期" ,
            example = "2025-05-01",  // 设置示例时间格式
            notes = "格式：yyyy-MM-dd"  // 说明时间格式
    )
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty("销售方出库日期")
    private String outDate;

    @ApiModelProperty(value = "销售方出库货品名称")
    @ExcelProperty("销售方出库货品名称")
    private String sellerGoodsName;

    @ApiModelProperty(value = "销售方出库单计量单位")
    @ExcelProperty("销售方出库单计量单位")
    private String sellerGoodsUnit;

    @ApiModelProperty(value = "销售方出库过磅单毛重")
    @ExcelProperty("销售方出库过磅单毛重")
    private Double sellerGrossWeight;

    @ApiModelProperty(value = "销售方出库过磅单皮重")
    @ExcelProperty("销售方出库过磅单皮重")
    private Double sellerTareWeight;

    @ApiModelProperty(value = "销售方折让/奖励金额")
    @ExcelProperty("销售方折让/奖励金额")
    private Double sellerRewardDiscountAmount;

    @ApiModelProperty(value = "销售方出库过磅单扣重")
    @ExcelProperty("销售方出库过磅单扣重")
    private Double sellerDeductWeight;


    @ApiModelProperty(value = "销售方出库过磅单扣点")
    private Double sellerDeductPercent;


    @ApiModelProperty(value = "销售方出库过磅单净重")
    @ExcelProperty("销售方出库过磅单净重")
    private Double sellerNetWeight;

    @ApiModelProperty(value = "销售方报价金额")
    @ExcelProperty("销售方报价金额")
    private Double sellerAmount;

    @ApiModelProperty(value = "销售方结算金额")
    @ExcelProperty("销售方结算金额")
    private Double sellerSettlementAmount;

    @ApiModelProperty(value = "销售方实收金额")
    @ExcelProperty("销售方实收金额")
    private Double sellerActualAmount;

    @ApiModelProperty(value = "购买方实付金额")
    @ExcelProperty("购买方实付金额")
    private String buyerActualAmount;

    @ApiModelProperty(value = "是否可编辑")
    private Boolean editable;

    @ApiModelProperty(value = "数据来源填 实时物流小程序  四流平台")
    private String dataSource;

    @ApiModelProperty(value = "跟单号")
    private String orderNum;

    /** 漯湾要求的 */
    @ApiModelProperty(value = "漯湾uid")

    @ExcelProperty("UID")
    private String uid;

    @ApiModelProperty(value = "签章状态 sign_status")
    private String signStatus;

    @ApiModelProperty(value = "签章状态 签章链接")
    private String signUrl;


}
